/**
 * 
 */
package com.james.wee.shuangseqiu.bo;


/**
 * @author Administrator
 * 
 */
public class OpenNumber implements IDBBo {
	private int id;
	private String opennum = null;
	private String n_1 = null;
	private String n_2 = null;
	private String n_3 = null;
	private String n_4 = null;
	private String n_5 = null;
	private String n_6 = null;
	private String n_blue = null;
	private String zumamaping = null;

	private String xingsha;
	private String kaijiangxiangjian;
	private String kaijiangjianlan;
	private String kaijiangjianac;
	private String kaijianghezhisplit;
	private String kaijiangweihesplit;
	private String kaijiangliangqijian;
	private String muiltyhezhisplit;
	private int muiltyhezhitf;
	private int xingshatf;
	private int xinagjiantf;
	private int jianglantf;
	private int jianactf;
	private int hezhisplittf;
	private int weihesplittf;
	private int liangqijiantf;

	private int calcSum;
	private String spacing;
	
	public String getSpacing() {
		return spacing;
	}

	public void setSpacing(String spacing) {
		this.spacing = spacing;
	}

	public int getCalcSum() {
		return calcSum;
	}

	public void setCalcSum(int calcSum) {
		this.calcSum = calcSum;
	}

	public String getMuiltyhezhisplit() {
		return muiltyhezhisplit;
	}

	public void setMuiltyhezhisplit(String muiltyhezhisplit) {
		this.muiltyhezhisplit = muiltyhezhisplit;
	}

	public int getMuiltyhezhitf() {
		return muiltyhezhitf;
	}

	public void setMuiltyhezhitf(int muiltyhezhitf) {
		this.muiltyhezhitf = muiltyhezhitf;
	}

	public int getXingshatf() {
		return xingshatf;
	}

	public void setXingshatf(int xingshatf) {
		this.xingshatf = xingshatf;
	}

	public String getKaijiangliangqijian() {
		return kaijiangliangqijian;
	}

	public void setKaijiangliangqijian(String kaijiangliangqijian) {
		this.kaijiangliangqijian = kaijiangliangqijian;
	}

	public OpenNumber() {
	}

	public OpenNumber(String opennum, String n_1, String n_2, String n_3,
			String n_4, String n_5, String n_6, String n_blue,int calcSum, String spacing,String zumamaping) {
		super();
		this.opennum = opennum;
		this.n_1 = n_1;
		this.n_2 = n_2;
		this.n_3 = n_3;
		this.n_4 = n_4;
		this.n_5 = n_5;
		this.n_6 = n_6;
		this.n_blue = n_blue;
		this.zumamaping = zumamaping;
		this.calcSum = calcSum;
		this.spacing=spacing;
	}

	public int getXinagjiantf() {
		return xinagjiantf;
	}

	public void setXinagjiantf(int xinagjiantf) {
		this.xinagjiantf = xinagjiantf;
	}

	public int getJianglantf() {
		return jianglantf;
	}

	public void setJianglantf(int jianglantf) {
		this.jianglantf = jianglantf;
	}

	public int getJianactf() {
		return jianactf;
	}

	public void setJianactf(int jianactf) {
		this.jianactf = jianactf;
	}

	public int getHezhisplittf() {
		return hezhisplittf;
	}

	public void setHezhisplittf(int hezhisplittf) {
		this.hezhisplittf = hezhisplittf;
	}

	public int getWeihesplittf() {
		return weihesplittf;
	}

	public void setWeihesplittf(int weihesplittf) {
		this.weihesplittf = weihesplittf;
	}

	public int getLiangqijiantf() {
		return liangqijiantf;
	}

	public void setLiangqijiantf(int liangqijiantf) {
		this.liangqijiantf = liangqijiantf;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getOpennum() {
		return opennum;
	}

	public void setOpennum(String opennum) {
		this.opennum = opennum;
	}

	public String getN_1() {
		return n_1;
	}

	public void setN_1(String n_1) {
		this.n_1 = n_1;
	}

	public String getN_2() {
		return n_2;
	}

	public void setN_2(String n_2) {
		this.n_2 = n_2;
	}

	public String getN_3() {
		return n_3;
	}

	public void setN_3(String n_3) {
		this.n_3 = n_3;
	}

	public String getN_4() {
		return n_4;
	}

	public void setN_4(String n_4) {
		this.n_4 = n_4;
	}

	public String getN_5() {
		return n_5;
	}

	public void setN_5(String n_5) {
		this.n_5 = n_5;
	}

	public String getN_6() {
		return n_6;
	}

	public void setN_6(String n_6) {
		this.n_6 = n_6;
	}

	public String getN_blue() {
		return n_blue;
	}

	public void setN_blue(String n_blue) {
		this.n_blue = n_blue;
	}

	public String getZumamaping() {
		return zumamaping;
	}

	public void setZumamaping(String zumamaping) {
		this.zumamaping = zumamaping;
	}

	public String getXingsha() {
		return xingsha;
	}

	public void setXingsha(String xingsha) {
		this.xingsha = xingsha;
	}

	public String getKaijiangxiangjian() {
		return kaijiangxiangjian;
	}

	public void setKaijiangxiangjian(String kaijiangxiangjian) {
		this.kaijiangxiangjian = kaijiangxiangjian;
	}

	public String getKaijiangjianlan() {
		return kaijiangjianlan;
	}

	public void setKaijiangjianlan(String kaijiangjianlan) {
		this.kaijiangjianlan = kaijiangjianlan;
	}

	public String getKaijiangjianac() {
		return kaijiangjianac;
	}

	public void setKaijiangjianac(String kaijiangjianac) {
		this.kaijiangjianac = kaijiangjianac;
	}

	public String getKaijianghezhisplit() {
		return kaijianghezhisplit;
	}

	public void setKaijianghezhisplit(String kaijianghezhisplit) {
		this.kaijianghezhisplit = kaijianghezhisplit;
	}

	public String getKaijiangweihesplit() {
		return kaijiangweihesplit;
	}

	public void setKaijiangweihesplit(String kaijiangweihesplit) {
		this.kaijiangweihesplit = kaijiangweihesplit;
	}

	@Override
	public String insertSql() {
		String sql = "INSERT INTO  OpenNumber"
				+ "(OPENNUM,N_1,N_2,N_3,N_4,N_5,N_6,N_BLUE,ZUMAMAPING)VALUES('"
				+ this.opennum + "','" + this.n_1 + "','" + this.n_2 + "','"
				+ this.n_3 + "','" + this.n_4 + "','" + this.n_5 + "','"
				+ this.n_6 + "','" + this.n_blue + "','" + this.zumamaping
				+ "')";
		return sql;
	}

	@Override
	public String updateSql() {
		String sql = null;
		if (null != this.zumamaping) {
			sql = "UPDATE OpenNumber" + " SET ZUMAMAPING='" + this.zumamaping
					+ "' WHERE ID = " + this.id;
		}
		return sql;
	}

	public String updateSpacing(){
		String sql = null;
		if (null != this.spacing) {
			sql = "UPDATE OpenNumber" + " SET spacing='" + this.spacing
					+ "' WHERE ID = " + this.id;
		}
		return sql;
	}
	public String updateMethod() {

		/*
		 * String sql = "UPDATE OpenNumber" + " SET xingsha='" + this.xingsha +
		 * "',kaijianghezhisplit='" + this.kaijianghezhisplit +
		 * "',kaijiangjianac='"+this.kaijiangjianac
		 * +"',kaijiangjianlan='"+this.kaijiangjianlan
		 * +"',kaijiangweihesplit='"+this.kaijiangweihesplit
		 * +"',kaijiangxiangjian='"+this.kaijiangxiangjian + "' WHERE ID = " +
		 * this.id;
		 */

		String sql2 = "UPDATE OpenNumber";
		String set = " SET ";
		if (null != xingsha && !"".equals(xingsha)) {
			sql2 += set + " xingsha='" + this.xingsha + "'";
			set = ",";
			sql2 += set + " xingshatf=" + this.xingshatf;
		}

		if (null != kaijianghezhisplit && !"".equals(kaijianghezhisplit)) {
			sql2 += set + " kaijianghezhisplit='" + this.kaijianghezhisplit
					+ "'";
			set = ",";
			sql2 += set + " hezhisplittf=" + this.hezhisplittf;
		}

		if (null != kaijiangjianac && !"".equals(kaijiangjianac)) {
			sql2 += set + " kaijiangjianac='" + this.kaijiangjianac + "'";
			set = ",";
			sql2 += set + " jianactf=" + this.jianactf;
		}

		if (null != kaijiangjianlan && !"".equals(kaijiangjianlan)) {
			sql2 += set + " kaijiangjianlan='" + this.kaijiangjianlan + "'";
			set = ",";
			sql2 += set + " jianglantf=" + this.jianglantf;
		}

		if (null != kaijiangweihesplit && !"".equals(kaijiangweihesplit)) {
			sql2 += set + " kaijiangweihesplit='" + this.kaijiangweihesplit
					+ "'";
			set = ",";
			sql2 += set + " weihesplittf=" + this.weihesplittf;
		}

		if (null != kaijiangxiangjian && !"".equals(kaijiangxiangjian)) {
			sql2 += set + " kaijiangxiangjian='" + this.kaijiangxiangjian + "'";
			set = ",";
			sql2 += set + " xinagjiantf=" + this.xinagjiantf;
		}

		if (null != kaijiangliangqijian && !"".equals(kaijiangliangqijian)) {
			sql2 += set + " kaijiangliangqijian='" + this.kaijiangliangqijian
					+ "'";
			set = ",";
			sql2 += set + " liangqijiantf=" + this.liangqijiantf;
		}
		if (null != this.muiltyhezhisplit && !"".equals(muiltyhezhisplit)) {
			sql2 += set + " muiltyhezhisplit='" + this.muiltyhezhisplit
					+ "'";
			set = ",";
			sql2 += set + " muiltyhezhitf=" + this.muiltyhezhitf;
		}
		if(this.calcSum!=0)
			sql2 += set + "calcSum =" + this.calcSum;
		sql2 += " WHERE ID = " + this.id;
		return sql2;
	}

	@Override
	public String getIdSql() {
		String sql = " SELECT ID FROM OpenNumber" + " WHERE N_1='" + this.n_1
				+ "' AND N_2='" + this.n_2 + "' AND N_3='" + this.n_3
				+ "' AND N_4='" + this.n_4 + "' AND N_5='" + this.n_5
				+ "' AND N_6='" + this.n_6 + "' AND N_BLUE='" + this.n_blue
				+ "'";
		return sql;
	}

	public String sixRedNum() {
		if (null == this.n_1) {
			return null;
		}
		return this.n_1 + "," + this.n_2 + "," + this.n_3 + "," + this.n_4
				+ "," + this.n_5 + "," + this.n_6;
	}

	public String countOrMaxRecd(QueryType type) {
		if (type.equals("COUNT"))
			return "SELECT COUNT(1)  as id FROM OpenNumber";
		else
			return "select * from OpenNumber where opennum =(SELECT max(opennum) as opennum FROM OpenNumber)";
	}

	@Override
	public String toString() {
		return this.opennum + ":" + this.n_1 + " " + this.n_2 + " " + this.n_3
				+ " " + this.n_4 + " " + this.n_5 + " " + this.n_6 + "|"
				+ this.n_blue + "|" + this.zumamaping;
	}

	public void printShaHao() {
		System.out.println("型杀号：" + this.xingsha);
		System.out.println("开奖号相减：" + this.kaijiangxiangjian);
		System.out.println("开奖号减蓝：" + this.kaijiangjianlan);
		System.out.println("开奖号减AC值：" + this.kaijiangjianac);
		System.out.println("开奖号和值分拆：" + this.kaijianghezhisplit);
		System.out.println("开奖号尾值分拆：" + this.kaijiangweihesplit);
		System.out.println("开奖号上两期:" + this.kaijiangliangqijian);
		System.out.println("开奖号乘减:" + this.muiltyhezhisplit);
		
	}
}
